@layout("/common/_container.html"){
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>设备列表</h5>
            </div>
            <div class="ibox-content">
                <div class="row row-lg">
                    <div class="col-sm-12">
                        <div class="row">
                            <div class="col-sm-3">
                                <#NameCon id="condition" name="名称" />
                            </div>
                            <div class="col-sm-3">
                                <#button name="搜索" icon="fa-search" clickFun="Device.query()"/>
                            </div>
                        </div>
                        <#table id="DeviceTable"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>

    /**
     * 设备管理管理初始化
     */
    var Device = {
        id: "DeviceTable",	//表格id
        seItem: null,		//选中的条目
        table: null,
        layerIndex: -1
    };

    var basePath = "http://localhost:8090/";

    /**
     * 初始化表格的列
     */
    Device.initColumn = function () {
        return [
            {field: 'selectItem', radio: true},
            {title: '设备编号', field: 'id', visible: true, align: 'center', valign: 'middle'},
            {title: '设备名称', field: 'deviceName', visible: true, align: 'center', valign: 'middle'},
            {title: '设备类型', field: 'deviceType', visible: true, align: 'center', valign: 'middle'},
            {title: '功效类型', field: 'functions', visible: true, align: 'center', valign: 'middle'},
            {title: '功能描述', field: 'functionDesc', visible: true, align: 'center', valign: 'middle'},
            {title: '生产厂家', field: 'manufacturer', visible: true, align: 'center', valign: 'middle'},
            {title: '设备型号', field: 'deviceModel', visible: true, align: 'center', valign: 'middle'},
            {title: '出厂日期', field: 'productDate', visible: true, align: 'center', valign: 'middle'},
            {title: '设备保质期', field: 'expirationDate', visible: true, align: 'center', valign: 'middle'},
            {title: '设备单价', field: 'devicePrice', visible: true, align: 'center', valign: 'middle'},
            {title: '库存量', field: 'deviceStock', visible: true, align: 'center', valign: 'middle'},
            {title: '设备图片', field: 'deviceImg', visible: true, align: 'center', valign: 'middle'},
            {title: '入库日期', field: 'createTime', visible: true, align: 'center', valign: 'middle'}
        ];
    };



    /**
     * ajax后台请求查询数据
     */
     function ajaxTest() {
        var condition = $("#condition").val();
        var params = {'deviceName':condition};

        $.ajax({
            type: 'post',
            url: basePath + '/api/service/device/mulQuery',
            data: params,//直接传递json。
            dataType: 'json',
            success: function(data) {
                alert(JSON.stringify(data));
                console.log("自定义展示方式");
                // ……
            }
        })
    }

    /**
     * 查询设备管理列表
     */
    Device.search = function () {
        var queryData = {};
        queryData['condition'] = $("#condition").val();
        Device.table.refresh({query: queryData});
    };

    /**
     * 查询设备列表
     */
    Device.query = function () {
        var params = {};
        params['deviceName'] = $("#condition").val();
        url = basePath + "/api/service/device/query/"+$("#condition").val();
        Device.table.refresh({url:url});
    };

    $(function () {
        var defaultColunms = Device.initColumn();
        var table = new BSTable(Device.id, basePath + "/api/service/device/list", defaultColunms);
        table.setMethod("get");
        table.setPaginationType("client");
        Device.table = table.init();
    });



</script>

@}
